const app = getApp()
var xrRequest = require('../../../vendor/hope-sdk/core/request.js');
var config = require('../../../config.js');
var xrSdk = require('../../../vendor/hope-sdk/index.js');
const util = require('../../../utils/util.js');
Page({
  /**
   * 页面的初始数据
   */
  data: {
    car_id : 0,
    car    : null
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    that.setData({
      car_id: options.id
    },()=>{
      that.initCar();
    });
  },
  initCar: function () {
    var that = this;
    xrRequest.request(app,{
      url: config.service.get_car_info_for_view,
      login: true,
      data:{
        id: that.data.car_id
      },
      success: function (res) {
        if (res.data.code == 1) {
          that.setData({
            car: res.data.data
          })
        } else {
          wx.showToast({
            title: res.data.msg,
            icon: 'none',
          })
        }
      },
      fail: function (res) {
        wx.showToast({
          title: res,
          icon: 'none',
        })
       },
      authfail: function (e) {
        wx.navigateTo({
          url: "../../auth/auth"
        })
      }
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },
  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },
  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },
  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  },
  nextClick: function (e) {
    wx.switchTab({
      url: '../../activity/apply/apply'
    });
  },
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  }
})